<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ApplicationController</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        
        <h1>
            <span class="type">Class</span>
            ApplicationController
            
                <span class="parent">&lt;
                    
                    ActionController::Base
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/app/controllers/application_controller_rb.html">app/controllers/application_controller.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-current_admin">current_admin</a>,
              </li>
            
              
              <li>
                <a href="#method-i-current_cart">current_cart</a>,
              </li>
            
              
              <li>
                <a href="#method-i-current_customer">current_customer</a>,
              </li>
            
              
              <li>
                <a href="#method-i-current_store">current_store</a>,
              </li>
            
              
              <li>
                <a href="#method-i-current_user">current_user</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-decode">decode</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-encode">encode</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-signed_in-3F">signed_in?</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-current_admin">
            
              <b>current_admin</b>()
            
            <a href="../classes/ApplicationController.html#method-i-current_admin" name="method-i-current_admin" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-current_admin_source')" id="l_method-i-current_admin_source">show</a>
                
              </p>
              <div id="method-i-current_admin_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 22</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_admin</span>
  <span class="ruby-ivar">@current_admin</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Staffer</span>.<span class="ruby-identifier">find_by</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">session</span>[<span class="ruby-value">:admin_id</span>])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-current_cart">
            
              <b>current_cart</b>()
            
            <a href="../classes/ApplicationController.html#method-i-current_cart" name="method-i-current_cart" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-current_cart_source')" id="l_method-i-current_cart_source">show</a>
                
              </p>
              <div id="method-i-current_cart_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_cart</span>
  <span class="ruby-ivar">@cart</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Cart</span>.<span class="ruby-identifier">find_or_create_by</span>(<span class="ruby-identifier">store_id</span><span class="ruby-operator">:</span> <span class="ruby-ivar">@normal_store_id</span>, <span class="ruby-identifier">store_customer_id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">current_customer</span>.<span class="ruby-identifier">id</span>)
  <span class="ruby-comment"># @cart ||= Cart.find_or_create_by(id: session[:cart_id])</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-current_customer">
            
              <b>current_customer</b>()
            
            <a href="../classes/ApplicationController.html#method-i-current_customer" name="method-i-current_customer" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-current_customer_source')" id="l_method-i-current_customer_source">show</a>
                
              </p>
              <div id="method-i-current_customer_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 26</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_customer</span>
  <span class="ruby-ivar">@current_customer</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StoreCustomer</span>.<span class="ruby-identifier">find_by</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">session</span>[<span class="ruby-value">:customer_id</span>])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-current_store">
            
              <b>current_store</b>()
            
            <a href="../classes/ApplicationController.html#method-i-current_store" name="method-i-current_store" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-current_store_source')" id="l_method-i-current_store_source">show</a>
                
              </p>
              <div id="method-i-current_store_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_store</span>
  <span class="ruby-ivar">@current_store</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">store</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">RecordNotFound</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@current_store</span>
  <span class="ruby-ivar">@current_store</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-current_user">
            
              <b>current_user</b>()
            
            <a href="../classes/ApplicationController.html#method-i-current_user" name="method-i-current_user" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-current_user_source')" id="l_method-i-current_user_source">show</a>
                
              </p>
              <div id="method-i-current_user_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_user</span>
  <span class="ruby-ivar">@current_user</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">StoreStaff</span>.<span class="ruby-identifier">find_by</span>(<span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-identifier">session</span>[<span class="ruby-value">:user_id</span>])
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-decode">
            
              <b>decode</b>(params)
            
            <a href="../classes/ApplicationController.html#method-i-decode" name="method-i-decode" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-decode_source')" id="l_method-i-decode_source">show</a>
                
              </p>
              <div id="method-i-decode_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">decode</span>(<span class="ruby-identifier">params</span>)
  <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">params</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-encode">
            
              <b>encode</b>(params)
            
            <a href="../classes/ApplicationController.html#method-i-encode" name="method-i-encode" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-encode_source')" id="l_method-i-encode_source">show</a>
                
              </p>
              <div id="method-i-encode_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">encode</span>(<span class="ruby-identifier">params</span>)
  <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">params</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-signed_in-3F">
            
              <b>signed_in?</b>()
            
            <a href="../classes/ApplicationController.html#method-i-signed_in-3F" name="method-i-signed_in-3F" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-signed_in-3F_source')" id="l_method-i-signed_in-3F_source">show</a>
                
              </p>
              <div id="method-i-signed_in-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/controllers/application_controller.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">signed_in?</span>
  <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">present?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>
